
#猜数字 V1.0
# import random
#
# n = random.choice(range(0,1001))
# is_flag = True
# while is_flag:
#      m = int(input("请输入0-1000的数字"))
#      if m > n:
#          print("您猜大了")
#      elif m < n:
#          print("您猜小了")
#      else:
#          print("恭喜猜中，本轮幸运数字：",n)
#          is_flag = False
#猜数字V2.0
# import random
# money = 5000
# n = random.choice(range(0,1001))
# is_flag = True
# while is_flag:
#      print("当前资金为：",money)
#      if money >= 0:
#          m = int(input("请输入0-1000的数字"))
#          if m > n:
#              print("猜大了")
#              money -= 500
#          elif m < n:
#              print("猜小了")
#              money -= 500
#          else:
#              print("恭喜猜中，本轮幸运数字：", n)
#              money += 3000
#              print("当前资金为：", money)
#              is_flag = False
#      else:
#          is_flag = False
#          print("余额不足，游戏结束")
#猜数字 V3.0
import random
money = 5000
is_continue = True
while is_continue:
    n = random.choice(range(0, 1001))
    is_flag = True
    while is_flag:
        print("当前资金为：",money)
        if money >= 0:
            m = int(input("请输入要猜的数字\n"))
            if m > n:
                print("猜大了")
                money -= 500
            elif m < n:
                print("猜小了")
                money -= 500
            else:
                print("恭喜猜中，本轮的幸运数字为：", n)
                money += 3000
                print("当前资金为： ", money)
                is_flag = False

        else:
            is_flag = False
            print("资金不足，游戏结束")
    else:
        print("是否继续：1.继续\t 其他数字.退出")
        o = int(input())
        if 1 == o:
            if money > 0:
                continue
            else:
                print("重新加载本金5000")
                money = 5000
                continue
            n = random.choice(range(0,1001))
        else:
            print("系统退出")
            is_continue = False

